﻿// Fill out your copyright notice in the Description page of Project Settings.


#include "SmartMovieSceneSubSectionExtensions.h"


int32 USmartMovieSceneSubSectionExtensions::SmGetStartOffsetFrame(UMovieSceneSubSection* SubSection)
{
	const UMovieScene* MovieScene = SubSection->GetTypedOuter<UMovieScene>();
	return ConvertFrameTime(SubSection->Parameters.StartFrameOffset,MovieScene->GetTickResolution(),  MovieScene->GetDisplayRate()).FloorToFrame().Value;
}

void USmartMovieSceneSubSectionExtensions::SmSetStartOffsetFrame(UMovieSceneSubSection* SubSection, int32 Frame)
{
	SubSection->Modify();
	const UMovieScene* MovieScene = SubSection->GetTypedOuter<UMovieScene>();
	
	SubSection->Parameters.StartFrameOffset = ConvertFrameTime(Frame,MovieScene->GetDisplayRate(), MovieScene->GetTickResolution()).FrameNumber;

		
}
